/* 
 *  <copyright file="BaseComponent.cs" company="Wesley Jowitt">
 *  
 *  SobrietyEngine: Copyright (c) 2011 Wesley Jowitt
 *  
 *  This software is distributed under a software license.
 *   * As of the creation time of this file, the license in use is the Microsoft Permissive License (Ms-PL) 
 *    * The license can be viewed at:
 *     * License.Txt in the root folder of this project
 *      * http://sobrietyengine.codeplex.com/license
 *       * http://www.microsoft.com/opensource/licenses.mspx
 *       
 *  </copyright>
 *   */

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using SobrietyEngine.Actor;
using SobrietyEngine.Common;


namespace SobrietyEngine.Components
{
    abstract public class BaseComponent:SobrietyEngine.Components.IComponent
    {
        public IActor Actor { get; private set; }

        public Boolean Initialized { get; set; }
        public Boolean SingleInstance { get; set; }
        public Boolean Active { get; set; }
        public Boolean RequiresUpdate { get; set; }

        public BaseComponent()
        {
            Active = true;
            SingleInstance = true;
            RequiresUpdate = true;
        }

        public override string ToString()
        {
            String str = this.GetType().ToString() + "( ";
            str += "ParentActor: " + Actor.Guid + ", ";
            str += "Active: " + Active.ToString() + ", ";
            str += "Initialized: " + Initialized.ToString() + ")";
            return str;
        }

        #region SobrietyEngine.Components.IComponent Members

        //value setting and copying
        virtual public List<ParameterDescription> GetParameterDescriptions()
        {
            throw new NotImplementedException();
        }

        virtual public void Set(Parameters parms)
        {
            throw new NotImplementedException();
        }

        virtual public Type[] SupportedInterfaces()
        {
            return new Type[] { };
        }

        public void SetParent(IActor _parentActor)
        {
            Actor = _parentActor;
        }

        virtual public void Update(GameTime ElapsedTime)
        {
        }

        virtual public Boolean InitComponent()
        {
            Initialized = true;          
            return true;
        }

        virtual public void Remove()
        {
            //throw new Exception("The method or operation is not implemented.");
        }

        #endregion
    }
}